#include <iostream>
using namespace std;

class Rect
{
public:
    Rect(int _w, int _h)
    {
        width = _w;
        height = _h;
    }
    void show()
    {
        cout << "width:" << width << " height:" << height << endl;
    }
    Rect operator+(int n)
    {
        this->width += n;
        this->height += n;
        return Rect(this->width , this->height);
    }
    Rect operator-(int n)
    {
        this->width -= n;
        this->height -= n;
        return Rect(this->width , this->height);
    }
    Rect operator+(Rect &other)
    {
        this->width += other.width;
        this->height += other.height;
        return Rect(this->width , this->height);
    }
    Rect operator-(Rect &other)
    {
        this->width -= other.width;
        this->height -= other.height;
        return Rect(this->width , this->height);
    }
    friend Rect operator+(int n,Rect &other);
    friend Rect operator-(int n,Rect &other);
private:
    int width;
    int height;
};

Rect operator+(int n,Rect &other)
{
    other.width += n;
    other.height += n;
    return Rect(other.width , other.height);
}
Rect operator-(int n,Rect &other)
{
    other.width -= n;
    other.height -= n;
    return Rect(other.width , other.height);
}
int main()
{
    Rect r1(10, 20);
    Rect r2(5, 5);
    Rect r3(13,15);
    // (r1 + r2).show();
    // (r1 + 20).show();
    // (r2 + r1).show();
    // (r2 + 20).show();
    Rect r4 = 9 + r1 + 5 + r2 + 6 + r3 - 7; 
    r4.show();
    return 0;
}